<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('审批离乌申请数据')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-lwsq-edit" th:object="${applicationInfo}">
            <input name="id" th:field="*{id}" type="hidden">


            <!--
            <div class="form-group">    
                <label class="col-sm-3 control-label">审核时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="shclsj" th:value="${#dates.format(applicationInfo.shclsj, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>-->
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">申请人姓名：</label>
                <div class="col-sm-8">
                    <input name="xm" th:field="*{xm}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">申请人性别：</label>
                <div class="col-sm-8">
                    <select name="xb" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{xb}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">申请人手机号码：</label>
                <div class="col-sm-8">
                    <input name="sjhm" th:field="*{sjhm}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">人员类型：</label>
                <div class="col-sm-8">
                    <select name="sfjn" class="form-control m-b" th:with="type=${@dict.getType('b_rylx')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{sfjn}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">近3天是否有发热、咳嗽等症状：</label>
                <div class="col-sm-8">
                    <select name="styc" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{styc}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">证件类型：</label>
                <div class="col-sm-8">
                    <select name="zjlx"  id="zjlx" class="form-control m-b" th:with="type=${@dict.getType('b_zjlx')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{zjlx}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">证件号码：</label>
                <div class="col-sm-8">
                    <input name="zjhm" id="zjhm" th:field="*{zjhm}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">入乌日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="rwrq" th:value="${#dates.format(applicationInfo.rwrq, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label control-label">暂住所类型：</label>
                <div class="col-sm-8">
                    <select name="zzslx" class="form-control m-b" th:with="type=${@dict.getType('b_zzslx')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue} " th:field="*{zzslx}"></option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label is-required">房间号：</label>
                <div class="col-sm-8">
                    <input name="by1" th:field="*{by1}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">所属社区：</label>
                <div class="col-sm-8">
                    <!--<select name="sqName" class="form-control m-b" th:with="type=${@dict.getType('b_ssjdb')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{sqName}"></option>
                    </select>-->
                    <div class="input-group">
                        <input class="form-control" type="text" name="sqName" onclick="selectDeptTree()" id="sqName" th:field="*{sqName}" required>
                        <input name="sqCode" id="sqCode" type="hidden" th:value="*{sqCode}">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                    <script type="text/javascript">
                        /* 选择部门树 */
                        function selectDeptTree() {
                            /*var treeId = $("#treeId").val();
                            var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();*/
                            var deptId="100";
                            var url = ctx + "system/dept/selectDeptTree/" + deptId;
                            var options = {
                                title: '选择所属社区',
                                width: "380",
                                url: url,
                                callBack: doSubmit
                            };
                            $.modal.openOptions(options);
                        };
                        function doSubmit(index, layero){
                            var tree = layero.find("iframe")[0].contentWindow.$._tree;
                            if ($.tree.notAllowParents(tree)) {
                                var body = layer.getChildFrame('body', index);
                                $("#sqCode").val(body.find('#treeId').val());
                                $("#sqName").val(body.find('#treeName').val());
                                layer.close(index);
                            }
                        }
                    </script>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">详细地址：</label>
                <div class="col-sm-8">
                    <textarea name="xxdz" class="form-control" required>[[*{xxdz}]]</textarea>
                </div>
            </div>
                <div class="form-group">
                <label class="col-sm-3 control-label">离乌方式：</label>
                <div class="col-sm-8">
                    <select name="lwfs" class="form-control m-b" th:with="type=${@dict.getType('b_jtfs')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{lwfs}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">车牌号码：</label>
                <div class="col-sm-8">
                    <input name="cphm" th:field="*{cphm}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">预期离乌日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="yqlwrq" th:value="${#dates.format(applicationInfo.yqlwrq, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">返程目的地：</label>
                <div class="col-sm-8">
                    <input name="fcmdd" th:field="*{fcmdd}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">具有核酸检测报告：</label>
                <div class="col-sm-8">
                    <select name="hsjc" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{hsjc}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">个人核算检测日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="hsjcRq" th:value="${#dates.format(applicationInfo.hsjcRq, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">具有双抗检测：</label>
                <div class="col-sm-8">
                    <select name="skjc" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">双抗检测日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="skjcRq"th:value="${#dates.format(applicationInfo.skjcRq, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">检测报告图片：</label>
                <div class="col-sm-8">
                    <div class="input-group date" >
                        <a  th:each=" p : ${pics}" th:href="'https://xjzd.zxingyun.cn:8089/'+${p}" target="_blank"> <img   width="80px" height="80px" th:src="'https://xjzd.zxingyun.cn:8089/'+${p}"></a>
                    </div>
                </div>
            </div>

            <hr>
            <hr>
            <div class="form-group">
                <label class="col-sm-3 control-label" style="color: red">审批状态：</label>
                <div class="col-sm-8">
                    <select name="spzt" class="form-control m-b" th:with="type=${@dict.getType('b_spzt')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{spzt}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">审核意见：</label>
                <div class="col-sm-8">
                    <textarea name="shyj" class="form-control">[[*{shyj}]]</textarea>
                </div>
            </div>




        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "lwsq/lwsq";
        $("#form-lwsq-edit").validate({
            focusCleanup: true,
            rules:{
                zjhm:{
                    required:true,
                    isIdentity:true
                },
                sjhm:{
                    isPhone:true
                }
            }
        });

        $(function(){

           var result = $("select[name=hsjc]").val();
           var skjc = $("select[name=skjc]").val();
           var by1 = $("select[name=zzslx]").val();
           var zjlx= $("#zjlx").find("option:selected").val();
           //核算检测效验
           if(result == "N"){
               $("input[name=hsjcRq]").rules("remove");
               $("input[name=hsjcRq]").closest("div.form-group").hide();
               $("input[name=hsjcRq]").removeAttr("value");
           }

           // 核算抗体效验
            if(skjc == "N"){
                $("input[name=skjcRq]").rules("remove");
                $("input[name=skjcRq]").closest("div.form-group").hide();
                $("input[name=skjcRq]").removeAttr("value");
            }


           if(by1 == "jd"){
               $("input[name=by1]").rules("remove");
               //房间号显示出来
               $("input[name=by1]").rules("edit", { required: true, messages: { required: "必填项，不能跳过"} });
               $("input[name=by1]").closest("div.form-group").show();
           }else{
               $("input[name=by1]").rules("remove");
               $("input[name=by1]").closest("div.form-group").hide();
               $("input[name=by1]").val("");
           }

            if("sfz"==zjlx){
                $("#zjhm").rules("remove");
                $("#zjhm").rules("edit", { required: true,isIdentity: true, messages: { required: "请正确输入您的身份证号码"} });
            }else{
                $("input[name=zjhm]").rules("remove");
                $("#zjhm").rules("add", { required: true, messages: { required: "必填项，不能跳过"} });
            }

            //证件类型
            $("#zjlx").change(function() {
                $.validate.reset();
                var type=$("#zjlx").find("option:selected").val();
                if("sfz"==type){
                    $("#zjhm").rules("remove");
                    $("#zjhm").rules("add", { required: true,isIdentity: true, messages: { required: "请正确输入您的身份证号码"} });
                }else{
                    $("input[name=zjhm]").rules("remove");
                    $("#zjhm").rules("add", { required: true, messages: { required: "必填项，不能跳过"} });
                }
            });
            //核算检测
            $("select[name=hsjc]").change(function() {
                $.validate.reset();
                var hs=$(this).find("option:selected").val().toLowerCase().trim();
                if("y"==hs){
                    $("input[name=hsjcRq]").rules("remove");
                    $("input[name=hsjcRq]").rules("edit", { required: true, messages: { required: "必填项，不能跳过"} });
                    $("input[name=hsjcRq]").closest("div.form-group").show()
                }else{
                    $("input[name=hsjcRq]").rules("remove");
                    $("input[name=hsjcRq]").closest("div.form-group").hide();
                    $("input[name=hsjcRq]").val("");
                }
            })
            //双抗检测
            $("select[name=skjc]").change(function() {
                $.validate.reset();
                var hs=$(this).find("option:selected").val().toLowerCase().trim();
                if("y"==hs){
                    $("input[name=skjcRq]").rules("remove");
                    $("input[name=skjcRq]").rules("edit", { required: true, messages: { required: "必填项，不能跳过"} });
                    $("input[name=skjcRq]").closest("div.form-group").show();
                }else{
                    $("input[name=skjcRq]").rules("remove");
                    $("input[name=skjcRq]").closest("div.form-group").hide();
                }
            })
            //离乌方式
            $("select[name=lwfs]").change(function() {
                $.validate.reset();
                var hs=$(this).find("option:selected").val().trim();
                if("zj"==hs){
                    $("input[name=cphm]").rules("remove");
                    $("input[name=cphm]").rules("edit", { required: true, messages: { required: "必填项，不能跳过"} });
                    $("input[name=cphm]").closest("div.form-group").show();
                }else{
                    $("input[name=cphm]").rules("remove");
                    $("input[name=cphm]").closest("div.form-group").hide();
                }
            });

            //房间号和暂住所类型绑定
            $("select[name=zzslx]").change(function() {
                $.validate.reset();
                var hs=$(this).find("option:selected").val();
                if("jd"==hs){
                    $("input[name=by1]").rules("remove");
                    //房间号显示出来
                    $("input[name=by1]").rules("edit", { required: true, messages: { required: "必填项，不能跳过"} });
                    $("input[name=by1]").closest("div.form-group").show();
                }else{
                    $("input[name=by1]").rules("remove");
                    $("input[name=by1]").closest("div.form-group").hide();
                    $("input[name=by1]").val("");
                }
            });

        })

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-lwsq-edit').serialize());
            }
        }
        $("input[name='shclsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='rwrq']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='yqlwrq']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='hsjcRq']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        $("input[name='skjcRq']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

    </script>
</body>
</html>